package com.bos.mapper;

import com.bos.data.model.BosParamModel;
import com.bos.data.model.SalesModel;
import org.apache.ibatis.annotations.*;

import java.util.List;
/*
 * 这是用来操作销售表的类
 *
 * */

public interface SalesMapper {
    //1查询出Salesbiao中的数据
    @Select("select * from  sales order by status")
    public List<SalesModel> findSales();

    //2.将数据插入到数据库中
    @Insert("insert into sales(status,sname,stype,money,sleader,content,point,target) values(#{status},#{sname},#{stype},#{money},#{sleader},#{content},#{point},#{target})")
    public int insertSales(SalesModel sales);

    //3.能够根据id删除数据
    @Delete("delete from Sales where id=#{id}")
    public int deleteById(int id);

    //4.根据id查询出对应的数据
    @Select("select * from Sales where id=#{id}")
    public SalesModel findSalsById(int id);

    //5.根据id修改sales表中的数据
    @Update("update Sales set status=#{status},sname=#{sname},stype=#{stype},money=#{money},sleader=#{sleader},content=#{content},point=#{point},target=#{target},update_time=#{update_time} where id=#{id}")
    public int updateByiD(SalesModel sales);

    //6.根据typeName为项目进度查询出数据
    @Select("select * from bos_param where typeName=#{typeName}")
    public List<BosParamModel> findBos_params(String typeName);

    //7.根据负责人，商机状态来多条件查询数据
    @SelectProvider(method = "findSales", type = SalesProvider.class)
    public List<SalesModel> selectByAll(String[] sleader, String[] status);
}
